Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
'Imports Microsoft.ApplicationBlocks.Data
Imports Microsoft.Reporting.WebForms

Partial Class Reportes_Controls_ctlRptReporteAltasSocio
    Inherits System.Web.UI.UserControl
    Public SearchValue(0 To 2) As SqlParameter

    Protected Sub btnRefrescar_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'ReportViewer1.Visible is set to false in design mode

        Dim thisConnection As New SqlConnection(DBUtilities.GetConnectionString)
        Dim thisDataSet As New System.Data.DataSet()
        SearchValue(0) = New SqlParameter("@Range", Me.txtRange.Text)
        SearchValue(1) = New SqlParameter("@FechaInicial", Me.txtStartDate.Value)
        SearchValue(2) = New SqlParameter("@FechaFinal", Me.txtEndDate.Value)
    

        'ReportDataSource datasource = new 

        'ReportDataSource("DataSetProducts_ShowProductByCategory", thisDataSet.Tables(0))
        'thisDataSet = SqlHelper.ExecuteDataset(thisConnection, "ShowProductByCategory", SearchValue)


        Dim datasource = New ReportDataSource("ClubReportes_sp_ReporteAltas", thisDataSet.Tables(0))

        ReportViewer1.LocalReport.DataSources.Clear()
        ReportViewer1.LocalReport.DataSources.Add(datasource)
        ReportViewer1.LocalReport.ReportPath = "~/App_Code/Reportes/Report.rdlc"

        If thisDataSet.Tables(0).Rows.Count = 0 Then
            lblMensaje.Text = "No existen registros en ese rango"

        End If
        ReportViewer1.Visible = True
        ReportViewer1.LocalReport.Refresh()


    End Sub

    Protected Sub chkIncludeDateRange_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        If chkIncludeDateRange.Checked = True Then
            Me.txtStartDate.Enabled = True
            Me.txtEndDate.Enabled = True
            Me.txtRange.Text = "1"
        Else
            Me.txtStartDate.Enabled = False
            Me.txtEndDate.Enabled = False
            Me.txtRange.Text = "0"
        End If
    End Sub

    
End Class
